package com.jltx.zeus.arch.api

import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory

/**
 * @author aidenquan
 *         Created by junlintianxia on 2020/10/09.
 */
object WeChatApiService {
    var retrofit: Retrofit
        private set
    var weChatApi: WeChatApi
        private set

    init  {
        retrofit = Retrofit.Builder()
            .baseUrl(ApiConstants.WECHAT_BASE_URL)
            .client(OkhttpClientFactoryUtils.okHttpClient)
            .addConverterFactory(ScalarsConverterFactory.create())
            .addConverterFactory(GsonFactoryUtils.providerGsonConverterFactory())
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .build()
        weChatApi = retrofit!!.create(WeChatApi::class.java)
    }
}